//
//  LeverSheetModel.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/5/26.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit
enum leverModelStyle {
    case leverTitleStyle
    case leverBuyStyle
    case leverTradeStyle
    case leverPriceStyle
    case leverInforStyle
    case leverSwitchStyle
    case leverPercentStyle //百分率
}
class LeverSheetModel: BaseModel {
    var style:leverModelStyle?
    var selectBool:Bool = false
    var name:String = ""
  
    class func changeModel(marktBool:Bool) -> Array<Array<LeverSheetModel>> {
        if marktBool {
            var gavelockSheetArr:Array<Array<LeverSheetModel>> = []

            let titleArr =  [[kText("买入方向"),"\(kText("买入")) 0","\(kText("卖出")) 0"],[kText("交易个数"),""],[kText("杠杆数"),"","","",""],[kText("需保证金"),""],[kText("止盈止损设置"),""],[kText("触发止损"),""],[kText("触发止盈"),""]]
            
            for i in 0 ..< titleArr.count {
                let nameArr = titleArr[i]
                var arr:Array<LeverSheetModel> = []
                for j in 0..<nameArr.count {
                    let nameStr = nameArr[j]
                    let model = LeverSheetModel()
                    model.name = nameStr
                    model.selectBool = false
                    if j == 0 {
                        model.style = .leverTitleStyle
                    }else {
                        if i == 0 {
                            model.style = .leverBuyStyle
                        }else if i == 1 {
                            model.style = .leverTradeStyle
                        }else if i == 3 {
                            model.style = .leverInforStyle
                        }else if i == 4 {
                            model.style = .leverSwitchStyle
                        }else if i == 5 || i == 6 {
                            model.style = .leverPercentStyle
                        }else {
                            model.style = .leverPriceStyle
                        }
                    }
                    arr.append(model)
                }
                gavelockSheetArr.append(arr)
            }
            return gavelockSheetArr
            
        }else {
            var gavelockLimtArr:Array<Array<LeverSheetModel>> = []
            let limitArr =  [[kText("买入方向"),kText("限价买入"),kText("限价卖出")],[kText("限价价格"),""],[kText("交易个数"),""],[kText("杠杆数"),"","",""],[kText("需保证金"),""],[kText("触发止损"),""],[kText("触发止盈"),""]]
            
            for i in 0 ..< limitArr.count {
                let nameArr = limitArr[i]
                var arr:Array<LeverSheetModel> = []
                for j in 0..<nameArr.count {
                    let nameStr = nameArr[j]
                    let model = LeverSheetModel()
                    model.name = nameStr
                    model.selectBool = false
                    if j == 0 {
                        model.style = .leverTitleStyle
                    }else {
                        if i == 0 {
                            model.style = .leverBuyStyle
                        }else if i == 1 || i == 2 {
                            model.style = .leverTradeStyle
                        }else if i == 4 {
                            model.style = .leverInforStyle
                        }else if i == 5 || i == 6 {
                            model.style = .leverPercentStyle
                        }else {
                            model.style = .leverPriceStyle
                        }
                    }
                    arr.append(model)
                }
                gavelockLimtArr.append(arr)
            }
            return gavelockLimtArr
            
        }
    }
}
